﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Management/Management.master" AutoEventWireup="true"
    CodeFile="ManageUser.aspx.cs" Inherits="Admin_ManageUser" %>

<%@ Import Namespace="System.Web.Security" %>
<%@ Import Namespace="Avatar.Common" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <asp:GridView ID="gv_user" runat="server" AutoGenerateColumns="False" AllowPaging="True"
        CellPadding="4" ForeColor="#333333" GridLines="None" PageSize="20">
        <RowStyle BackColor="#EFF3FB" />
        <Columns>
            <asp:TemplateField HeaderText="用户帐号">
                <ItemTemplate>
                    <%# Eval("UserName") %>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="最后登录">
                <ItemTemplate>
                    <%# Helper.DateTimeStringFormat(Membership.GetUser(Eval("UserName").ToString()).LastLoginDate) %>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="锁定">
                <ItemTemplate>
                    <%# Membership.GetUser(Eval("UserName").ToString()).IsLockedOut == true ? "已锁" : string.Empty %>
                    <%# Membership.GetUser(Eval("UserName").ToString()).IsApproved == false ? "已锁" : string.Empty %>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="在线">
                <ItemTemplate>
                    <%# Membership.GetUser(Eval("UserName").ToString()).IsOnline == true ? "在线" : string.Empty %>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="用户组">
                <ItemTemplate>
                    <%# GetRole(Roles.GetRolesForUser(Eval("UserName").ToString()))  %>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="操作">
                <ItemTemplate>
                    <asp:Button ID="btn_Lock" runat="server" Text="锁定/解锁" 
                        CommandArgument='<%# Eval("UserName") %>' onclick="btn_Lock_Click" />
                </ItemTemplate>
            </asp:TemplateField>
        </Columns>
        <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
        <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
        <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
        <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
        <EditRowStyle BackColor="#2461BF" />
        <AlternatingRowStyle BackColor="White" />
    </asp:GridView>
    <asp:Label ID="lbl_Error" runat="server" EnableViewState="false" ForeColor="Red" />
</asp:Content>
